<template>
  <view
    class="agreement"
    @click="
      active = !active;
      emits('active', active);
    "
  >
    <view class="dian" :class="{ active }">
      <view class="confirm"></view>
    </view>
    <view class="info">
      <text class="text">
        首次登陆会自动创建新账号,且代表同意
        <text class="y">《用户服务协议》</text>和
        <text class="y">《隐私政策》</text>
      </text>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";
const active = ref(false);
const emits = defineEmits(["active"]);
</script>

<style lang="scss" scoped>
.agreement {
  display: flex;
  align-items: center;
  align-content: center;
  .dian {
    width: 20rpx;
    height: 20rpx;
    display: inline-block;
    // background: #eb5757;
    line-height: 1;
    margin: 0;
    padding: 0;
    outline: none;

    border-radius: 50%;
    border: 1px solid #bdbdbd;
    display: flex;
    align-content: center;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    .confirm {
      border-radius: 50%;
      width: 100%;
      height: 100%;
      margin: 0;
    }
    &.active {
      border-color: #eb5757;
      .confirm {
        background-color: #eb5757;
      }
    }
  }
  .info {
    flex: 1;
    margin-left: 15rpx;
    .text {
      font-weight: normal;
      font-size: 24rpx;
      color: #828282;
      line-height: 28rpx;
      text-align: left;
    }
    .y {
      color: #eb5757;
    }
  }
}
</style>
